package com.example.utils;

import org.jasypt.util.text.BasicTextEncryptor;

/**
 * <pre>
 *      spring-boot-study-example
 * </pre>
 *
 * @author tao
 * @version v1.0.0
 * @since 2021/12/15 11:46
 */
public class JasyptUtil {

    public static void main(String[] args) {
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //加密所需的salt
        textEncryptor.setPassword("abc123");
        //要加密的数据（数据库的用户名或密码）
        String username = textEncryptor.encrypt("root");
        String password = textEncryptor.encrypt("Eric#2021");
        System.out.println("username:"+username);  // R8VMkVBojj9cQx9Z8MmqgA==
        System.out.println("password:"+password);  // kikNyFiNzNDy8/YtXDQxuQYSrW+1JY4u
    }
}
